package com.yxinmiracle.goods.feign;

import com.yxinmiracle.goods.pojo.Sku;
import entity.Result;
import org.omg.PortableInterceptor.LOCATION_FORWARD;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import sun.awt.SunHints;

import java.util.List;

/**
 * @version 1.0
 * @author： YxinMiracle
 * @date： 2021-08-12 11:28
 */
@FeignClient(name = "goods",path = "sku")
public interface SkuFeign {
    // 根据状态值查询复刻条件的sku数据列表
    @GetMapping("/status/{status}")
    public Result<List<Sku>> findByStatus(@PathVariable(name = "status")String status);

    @GetMapping(value = "/{id}")
    Result<Sku> findById(@PathVariable(value = "id") long id);

    /**
     * 减库存
     * @param id sku的ID
     * @param num 扣减的数量
     * @return
     */
    @GetMapping("/decCount")
    public Result decCount(@RequestParam(name="id") Long id, @RequestParam(name="num") Integer num);
}
